package com.cn.crmsystem.pojo;

public class ResultJson<T> {
    private String code;//200  404  500   200 有数据 没数据
    private String msg;
    private Long count;
    private T data;
    private String token;

    public String getToken() {
        return token;
    }

    public ResultJson getSuccess(String msg) {
        //newp
        this.msg = msg;
        this.code = "200";
        return this;
    }

    public ResultJson getSuccess(String msg, T data) {
        this.code = "200";
        this.msg = msg;
        this.data = data;
        return this;
    }

    public ResultJson getSuccess(String msg, String token, T data) {
        this.code = "200";
        this.msg = msg;
        this.token = token;
        this.data = data;
        return this;
    }

    public ResultJson getSuccess(String msg, String code) {
        this.code = "200";
        this.msg = msg;
        this.code = code;
        return this;
    }

    public ResultJson getSuccess(String msg, T data, Long count) {
        this.code = "200";
        this.msg = msg;
        this.data = data;
        this.count = count;
        return this;
    }

    public ResultJson getFail(String msg) {
        //new
        this.msg = msg;
        this.code = "-1";
        return this;
    }


    public String getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public Long getCount() {
        return count;
    }

    public T getData() {
        return data;
    }
}
